<template>
	<view class="Shop-Card" @click="toShopDetail(ShopCardData?.shopID)">
		<image class="coverImage" :src="imageUrl+ShopCardData?.shop_cover_img" mode="aspectFill"></image>
		<view class="right-shop-info">
			<view class="title">{{ShopCardData?.shop_Main_title}}</view>
			<view class="descriptive">{{ShopCardData?.shop_cover_desc}}</view>
			<view class="footer-prices-views">
				<view class="prices">￥{{ShopCardData?.shop_display_price}}<text style="font-size: 16rpx;"> 起 </text>/人</view>
				<view class="views">{{ShopCardData?.shop_page_view}}次浏览</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { imageUrl } from '@/config/request/request';
	import { routerGuard	} from '@/config/RouteGuard.js'
	import { watchEffect } from 'vue'
	const propos = defineProps({
		ShopCardData:{
			type:Object,
			default:()=>{}
		}
	})
	watchEffect(()=>{
		console.log('父组件传过来的社区Shop数据',propos.ShopCardData);
	})
	const toShopDetail = (shopId) => {
		console.log('商品id', shopId)
		const url = `/homeSubpages/ProductDetails/index?ShopId=${shopId}`;
		routerGuard(url);
	}
</script>

<style scoped lang="scss">
	.Shop-Card{
		width: 100%;
		height: 240rpx;
		display: flex;
		align-items: center;
		gap: 20rpx;
		padding: 20rpx;
		box-sizing: border-box;
		border-radius: 20rpx;
		border: 2rpx solid #e6e6e6;
		box-shadow: 0rpx 2rpx 3rpx 0rpx rgba(209, 209, 209, 0.2);
		.coverImage{
			width: 250rpx;
			height: 100%;
			border-radius: 10rpx;
		}
		.right-shop-info{
			max-height: 100%;
			min-height: 95%;
			max-width: calc(100% - 270rpx);
			min-width: calc(100% - 270rpx);
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.title{
				font-size: 28rpx;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 1; /* 设置最大行数 */
				overflow: hidden;
				text-overflow: ellipsis;
				line-height: 1.5em; /* 每行的高度 */
				word-break: break-all; /* 防止长单词导致布局破坏 */
			}
			.descriptive{
				font-size: 24rpx;
				color: #8f8f8f;
				font-family: 200;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 3; /* 设置最大行数 */
				overflow: hidden;
				text-overflow: ellipsis;
				word-break: break-all; /* 防止长单词导致布局破坏 */
			}
			.footer-prices-views{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.prices{
					font-size: 26rpx;
				}
				.views{
					font-size: 24rpx;
					color: #8f8f8f;
				}
			}
		}
	}
</style>